home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 June / EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso / imagestudio / imagestudio68000 / rexx / crop512x512.isrx < prev    next >
Text File  |  1995-07-27  |  3KB  |  108 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Get the size of the current image */
  15.  
  16. IMAGEINFO_GET STEM imageinfoinfo.
  17.  
  18. /* If there's no image, return */
  19.  
  20. if imageinfoinfo.width == -1 then
  21.     exit
  22.  
  23. /* If image is already smaller than 512x512, return */
  24.  
  25. if (imageinfoinfo.width <= 512) & (imageinfoinfo.height <= 512) then
  26.     exit
  27.  
  28. /* Crop to a max of 512x512 */
  29.  
  30. if imageinfoinfo.width > 512 then
  31.     width = 512
  32. else
  33.     width = imageinfoinfo.width
  34.  
  35. if imageinfoinfo.height > 512 then
  36.     height = 512
  37. else
  38.     height = imageinfoinfo.height
  39.  
  40. /* Set up region */
  41.  
  42. REGION_SET 0 0 width height
  43.  
  44. /* Crop region */
  45.  
  46. CROP
  47.  
  48. /* END PROGRAM ***************************************************/
  49.  
  50. exit
  51.  
  52. /* On ERROR */
  53.  
  54. ERROR:
  55.  
  56. /* If we get here, either an error occurred with the command's */
  57. /* execution or there was an error with the command itself. */
  58. /* In the former case, rc2 contains the error message and in */
  59. /* the latter, rc2 contains an error number. SIGL contains */
  60. /* the line number of the command which caused the jump */
  61. /* to ERROR: */
  62.  
  63. if datatype(rc2,'NUMERIC') == 1 then do
  64.     /* See if we can describe the error with a string */
  65.  
  66.     select
  67.         when rc2 == 103 then
  68.             err_string = "ERROR 103, "||,
  69.                 "out of memory at line "||SIGL
  70.         when rc2 == 114 then
  71.             err_string = "ERROR 114, "||,
  72.                 "bad command template at line "||SIGL
  73.         when rc2 == 115 then
  74.             err_string = "ERROR 115, "||,
  75.                 "bad number for /N argument at line "||SIGL
  76.         when rc2 == 116 then
  77.             err_string = "ERROR 116, "||,
  78.                 "required argument missing at line "||SIGL
  79.         when rc2 == 117 then
  80.             err_string = "ERROR 117, "||,
  81.                 "value after keywork missing at line "||SIGL
  82.         when rc2 == 118 then
  83.             err_string = "ERROR 118, "||,
  84.                 "wrong number of arguments at line "||SIGL
  85.         when rc2 == 119 then
  86.             err_string = "ERROR 119, "||,
  87.                 "unmatched quotes at line "||SIGL
  88.         when rc2 == 120 then
  89.             err_string = "ERROR 120, "||,
  90.                 "line too long at line "||SIGL
  91.         when rc2 == 236 then
  92.             err_string = "ERROR 236, "||,
  93.                 "unknown command at line "||SIGL
  94.         otherwise
  95.             err_string = "ERROR "||rc2||", at line "||SIGL
  96.         end
  97.         end
  98. else if rc2 == 'RC2' then do
  99.     err_string = "ERROR in command at line "||SIGL
  100.     end
  101. else do
  102.         err_string = rc2||", line "||SIGL
  103.         end
  104.  
  105. request_message TEXT '"'err_string'"'
  106.  
  107. exit
  108.